package common;

import entity.Commodity;
import entity.User;

import java.sql.ResultSet;
import java.sql.SQLException;

public class EntityChange {

    public static User UserChange(ResultSet resultSet) throws SQLException {
        User user = new User(resultSet.getString(1),resultSet.getString(2));
        return user;
    }

    public static Commodity CommodityChange(ResultSet resultSet)throws SQLException{
        Enum<CommodityKind> kindEnum = CommodityKind.find(resultSet.getString(3));
        Commodity commodity = new Commodity(resultSet.getString(1),resultSet.getString(2),kindEnum,resultSet.getFloat(4));
        return commodity;
    }
}
